<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="/common/jsp/taglibs-nojs-nocss.jsp"%>
<%@include file="/common/jsp/cssAndScript.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>


<div id="pop_up_content">
	<div class="pop_up_title images_1">
		新建用户
	</div>
	<div class="pop_up_body">
		<form id="userAdd" name="userAdd" action="userManager/addUser.action">
		<table border="0" cellpadding="0" cellspacing="0"  width="400">
			<tr>
				<td>
					<div class="form_input_value">
						用户名
					</div>
				</td>
				<td>
					<input  type="text" id="name" name="user.name" class="dialogy_input max_length:15 required" value="<s:property value='user.name'/>"/>
					<!-- 用户状态 -->
					<input  type="hidden" id="id" name="user.id" value="<s:property value='user.id'/>" >
					<input type="hidden" id="status" class="longinput" name="user.status" value="1">
				</td>
			</tr>
			<tr>
				<td>
					<div class="form_input_value">
						中文名称
					</div>
				</td>
				<td>
					<input type="text" id="cname" class="dialogy_input max_length:15 required" name="user.cname" value="<s:property value='user.cname'/>">
				</td>
			</tr>
			<tr>
				<td>
					<div class="form_input_value">
						所属部门
					</div>
				</td>
				<td>
					<select name="user.department.ooid">
						<s:iterator id="dept" value="departmentList">
							
							<s:if test="user.department.id==id">
								<option value='<s:property value="id"/>' selected="selected"><s:property value="tempName"/></option>
							</s:if>
							<s:else>
								<option value='<s:property value="id"/>'><s:property value="tempName"/></option>
							</s:else>
						</s:iterator>
					</select>
				</td>
			</tr>
			<tr>
				<td>
					<div class="form_input_value">
						备注
					</div>
				</td>
				<td>
					<input type="text" id="memo" class="longinput" name="user.memo" value="<s:property value='user.memo'/>">
				</td>
			</tr>
			<tr>
				<td>
					<div class="form_input_value">
						选择角色
					</div>
				</td>
				<td>
					<s:select id="u_roleList" list="roleList" name="u_roleList[0].role.id" headerKey="" headerValue="请选择" listKey="id" listValue="cname" value="user.roles.iterator.next.role.id" theme="simple" cssClass="required"/>
				</td>
			</tr>
			<tr>
				<td></td>
				<td>
					<input id="editSubmit" type="button" value="确定" class="btn" onmouseout="this.className='btn'" onmousedown="this.className='btn1'" onmouseover="this.className='btn2'">
					<input type="button" value="取消" class="btn" onclick="hideDialog();" onmouseout="this.className='btn'" onmousedown="this.className='btn1'" onmouseover="this.className='btn2'">
				</td>
			</tr>
		</table>
		</form>
	</div>
</div>
<script type="text/javascript">
/* 表单提交 */
i.formSubmit("editSubmit",	//绑定的按钮id
				  "userAdd" ,   //提交的表单id
				  function(result){
					  	var jsonMsgObj=new JsonMsgObj(result);
						var  msg=jsonMsgObj.getMessage();
					    var codeId=jsonMsgObj.getCodeid();
						var isOk=jsonMsgObj.getIsok();
						if( isOk ){
						    aerouiAlert(msg);
							hideDialog();// 隐藏窗口
							loadContentLink('<%=basePath %>userManager/getAllUser.action');
						}else{		// 如果编辑失败了
						  JsManageInfoHandleException( result , function(msg , codeId , isOk){
							  aerouiAlert(msg);
						   });
					   }
					});
</script>
